UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TUsvas8h4lFNk0H8CaiAk7H5tYflJE7eZSu5pluWdIY='
WHERE
key_id = 'cd7d590bca2f35c77603c473f425710e439449b09191cd3b4e81f83a3a9c974d'
AND (
token = 'TUsvas8h4lFNk0H8CaiAk7H5tYflJE7eZSu5pluWdIY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)