UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '06GOPakdOgqcitZ9EUW9ZcSDTKlfT4DcWCGKjEjSvcQ='
WHERE
key_id = '77f013fbbe6df6d596afd2c8f09f6a5858996b403e61d8a002ffa84c01a7de0c'
AND (
token = '06GOPakdOgqcitZ9EUW9ZcSDTKlfT4DcWCGKjEjSvcQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)