UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LC3mQePmzrUPKGhJkDcD1RokNdxryFs9Vpn8361z+sU='
WHERE
key_id = 'e0d530537961aeb467972b24cd4008987b52c70c12def4d55fd22e4edead2bd6'
AND (
token = 'LC3mQePmzrUPKGhJkDcD1RokNdxryFs9Vpn8361z+sU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)