UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RSU6SDtUBMvcW8khp83y0Q15MKUhrEg8g9EHehrkO4Q=' 
WHERE 
  key_id = '3217842241d86b08b664eabd8c63f79e5627e1e10d1ac9142da3d5ed9f66a015' 
  AND (
    token = 'RSU6SDtUBMvcW8khp83y0Q15MKUhrEg8g9EHehrkO4Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025