UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BSncMO2OnEeDh8TrjLlyKZw7XDgha88POy/W7gMDcVo='
WHERE
key_id = 'b4da32fa899589ff47913f431a8e8671a0b6fa1319db1163c6e7b25dff9a1f8a'
AND (
token = 'BSncMO2OnEeDh8TrjLlyKZw7XDgha88POy/W7gMDcVo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)