UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '29jV/OZXEdkEsBRPa70imGoQaLcbIOoGaq8kU/xLLvY=' 
WHERE 
  key_id = '3875ed2138f628e7266208ce1fb1374590c0cb05e5e43768ba7effde9b535772' 
  AND (
    token = '29jV/OZXEdkEsBRPa70imGoQaLcbIOoGaq8kU/xLLvY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035