UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/P3dIi/N7L9M7bjSHlnLWSMd/Ge4RPJPjsGbLEj+F+k=' 
WHERE 
  key_id = '21129ea3ba1553a698f3ed164e04323b6d349bb5f2aa2da957ed812653e41a89' 
  AND (
    token = '/P3dIi/N7L9M7bjSHlnLWSMd/Ge4RPJPjsGbLEj+F+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032