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

Query time 0.00047