UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YCyfpmF2CL4w+6mxpTHTs1tgbwmih0j4jH4XswZy8Sw='
WHERE
key_id = 'f24e0ac92b6ba9b09b4c4b2b556b27d3a0cb50513ae8234bc3e10edb72a87eb4'
AND (
token = 'YCyfpmF2CL4w+6mxpTHTs1tgbwmih0j4jH4XswZy8Sw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)