UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LgSeS+3WJVEd38AD8U6ovCsN2wp2M5Th6e2jjmajz+U='
WHERE
key_id = 'b4ccca1e93d2023cc51940a1c3541dc7e3754c5982b33933b4a56291be2b0ead'
AND (
token = 'LgSeS+3WJVEd38AD8U6ovCsN2wp2M5Th6e2jjmajz+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)