UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+mgg+VyOKVZHWZBT9OWObQIIIruDI3RVYOCw38PAOHc=' 
WHERE 
  key_id = 'e4b81490a7630277b1013e73779769ecabb03837f38d5221354e083011d563ea' 
  AND (
    token = '+mgg+VyOKVZHWZBT9OWObQIIIruDI3RVYOCw38PAOHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017