UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FlLbmA5Zj7LFu6SN3Ky0nWfrNGlRN4LeJ5tQJ+Tsz8Y='
WHERE
key_id = '8c947ba8f56ad39bd105187264d6c70eb09e68a4de1d0e9717ed62e56eb3d8d8'
AND (
token = 'FlLbmA5Zj7LFu6SN3Ky0nWfrNGlRN4LeJ5tQJ+Tsz8Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)