UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n0/rIAAXAdyrdkKi4VSmHrSxgUdHtTjk10MrWtevhS4='
WHERE
key_id = '43974127ebc6aacd3926961d29776ad8a1814af3b2053b756722af2f95b09c81'
AND (
token = 'n0/rIAAXAdyrdkKi4VSmHrSxgUdHtTjk10MrWtevhS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)