UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YLkQS5Kq6fsCGQiZNQE83hbmAxXtXRMbCqytl1N2DuI='
WHERE
key_id = '7f9fb8449f82b231ae2ad938954e4647e0c0e4ea03503064f8647e935ebe7be3'
AND (
token = 'YLkQS5Kq6fsCGQiZNQE83hbmAxXtXRMbCqytl1N2DuI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)