UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jqStThQdaoHV0itfDrkuO6iGYKE2rC71mtagIU+R3Rc='
WHERE
key_id = '8a51936643f4f316751e98380aea4952f95b7f28be413187d537699379680924'
AND (
token = 'jqStThQdaoHV0itfDrkuO6iGYKE2rC71mtagIU+R3Rc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)