UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Qg3rzOXWGEl/UxzjLhcWzQAZ/zGHybhOUcoysmEqNvs='
WHERE
key_id = 'a4c9356b6578959f03257249d2cb9c0472a4b61c8901d3a98b501009fdf40691'
AND (
token = 'Qg3rzOXWGEl/UxzjLhcWzQAZ/zGHybhOUcoysmEqNvs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)