UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9+otiADuRZ8dK7YRhkVyeCjaWR17pceea/JBTekUEEY=' 
WHERE 
  key_id = '99aaabba682aacb01d7930fbe6a0048c618349055da644535d91e05918fc8263' 
  AND (
    token = '9+otiADuRZ8dK7YRhkVyeCjaWR17pceea/JBTekUEEY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040