UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WcejrLTKzrUt+7QZfmDZElpxi+cpEhZbVDr6kGq35XQ='
WHERE
key_id = 'c2da871392961bc2339c4c6fe684a92259571b2cd01bf0bf4110decd3399d385'
AND (
token = 'WcejrLTKzrUt+7QZfmDZElpxi+cpEhZbVDr6kGq35XQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)