UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fC/h9mXNjqsFu4PZdoIKFmXkLEQSfZOHYhNuKmJo9g4=' 
WHERE 
  key_id = '47ce4ff0ac3197ddec412229e9feb34d8bbf7b506d7f9c1873703058b54daffe' 
  AND (
    token = 'fC/h9mXNjqsFu4PZdoIKFmXkLEQSfZOHYhNuKmJo9g4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047