UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'do7lU8LiiOH0uUQNxL1hzPLSkS+4WP+gHIRLWSTH1wY=' 
WHERE 
  key_id = 'cfb3a79f38fa7ab25198508e1336b8b26ca9c21007bf1bb8c60003dc5da7c807' 
  AND (
    token = 'do7lU8LiiOH0uUQNxL1hzPLSkS+4WP+gHIRLWSTH1wY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034