UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yudjTl/7D31wokqohlpT4nHClkJef7lWJILa5dlVym4='
WHERE
key_id = 'ba6b5cf69b6834e3dac9142b0eeea876e2fc2aa3e111ffa8635176fc7de35eb3'
AND (
token = 'yudjTl/7D31wokqohlpT4nHClkJef7lWJILa5dlVym4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)