UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6S62QB9DJC6h+XG9jMBjyTTuQufIvTJT2UVhH9etRjk='
WHERE
key_id = 'a2d735ecdad1c89950a02ff0b2ed1a1725afe99b25af44f110aaf74b50ec353f'
AND (
token = '6S62QB9DJC6h+XG9jMBjyTTuQufIvTJT2UVhH9etRjk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)