UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MVWh1QhFt2hR1bgLFP5jbxwP3hnwbI+E241gm3THueE='
WHERE
key_id = 'b649e84634efa404c8d8c9f4aca2be785b5de53989119a8dffee36a7ac9b1102'
AND (
token = 'MVWh1QhFt2hR1bgLFP5jbxwP3hnwbI+E241gm3THueE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)