UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I6UdHM9ENRe9vhUigFayZoqZ/8EG4s8qkMLT8IYQjpA='
WHERE
key_id = '24deb45109b74281ca6230bf8dded496b1696b194ed5b1e0979d11c25469a239'
AND (
token = 'I6UdHM9ENRe9vhUigFayZoqZ/8EG4s8qkMLT8IYQjpA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)