UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6Z3M8o2dvMXSF02ly/EO64tuuVvM4g9ySEssDqhe928=' 
WHERE 
  key_id = 'a5808d40c3ed550708b808c3bc26367d62180c4cac1e839b558e597e94a229fa' 
  AND (
    token = '6Z3M8o2dvMXSF02ly/EO64tuuVvM4g9ySEssDqhe928=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052