UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sNf7b77mFBBm3lCR+9rAvKut1H/6DXpGBuTSJXsMP0M='
WHERE
key_id = 'e01e3824775bc82ce681aba8d5426c2126216c5c004a6557a223fb700f153c8c'
AND (
token = 'sNf7b77mFBBm3lCR+9rAvKut1H/6DXpGBuTSJXsMP0M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)