UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C9XTwj1be8QMUyAo5zCanfXKd+eZHeNjMT0MGAQurs0='
WHERE
key_id = '5f72fb9aebbff04615de2027b02adf70d5b0af8025d8f4c141544e6012a55ba5'
AND (
token = 'C9XTwj1be8QMUyAo5zCanfXKd+eZHeNjMT0MGAQurs0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)