UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1XVPI7BiJVndmsiaEMmqI131nSNQXQO9VlNCvk4aIIY='
WHERE
key_id = 'a1e29622993760e64abf7610f9378c0e8b29419d7fa1d134d016d829a5c19a8b'
AND (
token = '1XVPI7BiJVndmsiaEMmqI131nSNQXQO9VlNCvk4aIIY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)