UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z7kQ7twkJP0OYFS4fSGyJj+ki0j8QeruDy8YgeapXhE='
WHERE
key_id = 'aa1ffcbfdda527abe6a4a3b2fd8bc662207e78598a43f9dab6501f1fd8ea189a'
AND (
token = 'Z7kQ7twkJP0OYFS4fSGyJj+ki0j8QeruDy8YgeapXhE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)