UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OKt5SuMO6qn8pDG+rADcpo27F7IP35n+GzKDzWqyif0=' 
WHERE 
  key_id = 'ae0a81a33294b72dfd299e5c77de01c623d18b6a4234ac4afe69470475867f43' 
  AND (
    token = 'OKt5SuMO6qn8pDG+rADcpo27F7IP35n+GzKDzWqyif0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043