UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JHYdQPb3ItDdW3KV5Ddg1LntHx9mwnwGo71GOj2GxeE='
WHERE
key_id = 'a99ecc9da0ccd3f6a77ca522c5a2e40570c0a92d1e1363d554a5d35cec9728d0'
AND (
token = 'JHYdQPb3ItDdW3KV5Ddg1LntHx9mwnwGo71GOj2GxeE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)