UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uG5TQv18iVTOWfw1SMP1q+zNOxKokRzhMqSdOBKn9JU=' 
WHERE 
  key_id = '3e15157bc0f922fded0450a7caddc3a66d81884814c58b52d15863f8f59add50' 
  AND (
    token = 'uG5TQv18iVTOWfw1SMP1q+zNOxKokRzhMqSdOBKn9JU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016