UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xXCU2xsczEX916NpxjYEzU4mogr60+a2lm6yh/BheT0=' 
WHERE 
  key_id = '8ad0daf782901e0557b2d3c7c9593c920bab4d237fad4920c4467fff23ef8683' 
  AND (
    token = 'xXCU2xsczEX916NpxjYEzU4mogr60+a2lm6yh/BheT0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034