UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pQ346wKbgXsCPS28TNdgsOlC6ZFUw9maP7R/9FITtMY='
WHERE
key_id = '1aad912f5defaa29f64d116e68b7d6dcd5eeb43ce3e412d165ad8c86dd3b8807'
AND (
token = 'pQ346wKbgXsCPS28TNdgsOlC6ZFUw9maP7R/9FITtMY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)